import {getOrderList, getPaymentList, postOrderList} from "@/api/order";

export default {
    namespaced:true,
    state:{
        orderInfo:{},
        paymentInfo:{}
    },
    actions:{
        async getOrderListAsync({commit}){
            const response = await getOrderList();
            commit('SET_ORDER_INFO',response.data);
        },
        async getPaymentListAsync({commit},id){
            const response = await getPaymentList(id);
            console.log(response);
        },
        async postOrderListAsync({commit},body){
            const response = await postOrderList(body);
            console.log(response);
        }
    },
    mutations:{
        SET_ORDER_INFO(state,payload){
            state.orderInfo = payload;
        },
        SET_PAYMENT_INFO(state,payload){
            state.paymentInfo = payload;
        }
    }
}